package com.xoa.dev.efficiency.controller;

import com.xoa.dev.efficiency.model.FlowSettingHoliday;
import com.xoa.model.users.Users;
import com.xoa.dev.efficiency.service.FlowSettingHolidayService;
import com.xoa.util.ToJson;
import com.xoa.util.common.session.SessionUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/*
Created by wuwei on 2018-07-22 07:32
* */

@Controller
@RequestMapping("/FlowSettingHoliday")   //   /FlowSettingHoliday/index
public class FlowSettingHolidayController {
    @Resource
    private FlowSettingHolidayService flowSettingHolidayService;
    @RequestMapping("/index")
    public String address() {
        return "app/dev/efficiency/setting/flowSettingHoliday";
    }

    @RequestMapping("/insertFlowSettingHoliday")
    @ResponseBody
    public ToJson<FlowSettingHoliday> insertFlowSettingHoliday(FlowSettingHoliday flowsettingholiday, HttpServletRequest request){
        Users user = SessionUtils.getSessionInfo(request.getSession(), Users.class, new Users());
        return flowSettingHolidayService.insertFlowSettingHoliday(flowsettingholiday,user);
    }

    @RequestMapping("/selectFlowSettingHoliday")
    @ResponseBody
    public ToJson<FlowSettingHoliday> selectFlowSettingHoliday(FlowSettingHoliday flowsettingholiday,HttpServletRequest request){
        return flowSettingHolidayService.selectFlowSettingHoliday(flowsettingholiday);
    }

    @RequestMapping("/deleteByPrimaryKey")
    @ResponseBody
    public ToJson<FlowSettingHoliday> deleteByPrimaryKey(Integer holidayId){
        return flowSettingHolidayService.deleteByPrimaryKey(holidayId);
    }

    @RequestMapping("/updateByPrimaryKey")
    @ResponseBody
    public ToJson<FlowSettingHoliday> updateByPrimaryKey(FlowSettingHoliday flowsettingholiday){
        return flowSettingHolidayService.updateByPrimaryKey(flowsettingholiday);
    }

}
